<?php defined("MAIN_DIR") or die("No direct access"); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="<?php
	echo isset($head_description) ? $head_description : "Банковский справочник ";
?>">
<meta name="Keywords" content="<?php
	echo isset($head_keywords) ? $head_keywords : "банки";
?>">
<title><?php echo isset($head_title) ? $head_title : "Гора банков"; ?></title>
<link href="/files/css/styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div align="center">
	<div id="main" align="left">
		<div id="logo"><a href="/"><img src="/files/images/logo.png" border="0" /></a></div>
		<div id="banner_top"><?php
			$top_banner = $db->getCell("select `code` from `banners` where `position` = 'top' and `power` = 'on' and `before` > '".time()."' limit 1");
			echo $top_banner;
		?></div>
		<div style="clear:both"></div>
		<?php $cities_text = $db->getRow("select `header`,`text` from `info` where `info_id` = '19' limit 1"); ?>
		<h1><?php echo $cities_text['header']; ?></h1>
		<p><?php echo str_replace("{city}","",str_replace("{city_rod}","",str_replace("{city_pred}","",$cities_text['text']))); ?></p>
		
		<table id="city_select">
			<tr><td><?php
				$cities = $db->getTable("select `path`,`city_name` from `city` where `power` = 'on' order by `city_name`");
				$letter = "";
				foreach ($cities as $key => $tcity) {
					$this_letter = $tcity['city_name'][0].$tcity['city_name'][1];
					if ($this_letter != $letter){
						if ($letter != "")
							echo "</td></tr>";
						echo "<tr><td>".$this_letter."</td><td>";
						$letter = $tcity['city_name'][0].$tcity['city_name'][1];
					}
					echo "<a href='/$tcity[path]'>$tcity[city_name]</a>";
					if ($key < count($cities)-1 && $cities[$key+1]['city_name'][0].$cities[$key+1]['city_name'][1] == $letter)
						echo ", ";
				}
			?></td></tr>
		</table>
		<div id="copyright">2010 © «Гора Банков»</div>
	</div>
</div>
</body>
</html>